package com.javachmapi.springbootjdbctemplatemultipledatasources.config;

import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * 多数据源配置
 * create by 宋利军
 */
@Configuration
public class DataSourceConfig {

    @Bean
    @ConfigurationProperties(value = "spring.datasource.one")
    DataSource dsOne(){
        return DruidDataSourceBuilder.create().build();
    }

    @Bean
    @ConfigurationProperties(value = "spring.datasource.tow")
    DataSource dsTow(){
        return DruidDataSourceBuilder.create().build();
    }
}
